<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<!--f:view-->
<h:head></h:head>
<!--<f:metadata>
    <f:viewParam name="idRol" value="#{userBean.id}"/>
</f:metadata>-->

<h:body>
<h:form id="pForm">
  <h:panelGroup>
    <h:panelGrid columns="3">
                   
      <h:outputLabel for="name" value="#{msg['Client.name']}"/>
      <h:inputText id="name" value="#{clientView.client.name}" required="true">
        <f:ajax render="clientOnServerSide" execute="@this" />
      </h:inputText>
      <h:message for="name" />
   
      <h:outputLabel for="vip" value="#{msg['Client.vip']}"/>
      <h:selectBooleanCheckbox id="vip" value="#{clientView.client.vip}" valueChangeListener="#{clientView.vipChangeListener}"
        immediate="true" >
        <f:ajax render="clientOnServerSide" execute="@this" />
      </h:selectBooleanCheckbox>
      <h:message for="vip" />
   
      <h:outputLabel for="country" value="#{msg['Client.country']}"/>          
      <h:selectOneMenu id="country" value="#{clientView.country}" converter="selectItemsConverter"
        valueChangeListener="#{clientView.countryChangeListener}" immediate="true">
        <f:ajax render="clientOnServerSide city" />
        <f:selectItem itemLabel="#{msg['noSelectOption']}" noSelectionOption="true"/>
        <f:selectItems value="#{clientView.countries}" var="country" itemValue="#{country}" itemLabel="#{country.name}" />
      </h:selectOneMenu>
      <h:message for="country" />
   
      <h:outputLabel for="city" value="#{msg['Client.city']}"/>        
      <h:selectOneMenu id="city" value="#{clientView.client.city}" converter="selectItemsConverter">
        <f:ajax render="clientOnServerSide" execute="@this" />
        <f:selectItems value="#{clientView.cities}" var="city" itemValue="#{city}" itemLabel="#{city.name}" />
      </h:selectOneMenu>
      <h:message for="city" />
                                                                   
    </h:panelGrid>
 
  </h:panelGroup>
 
  <br />
  <h:commandButton action="#{clientView.save}" value="#{msg['btn.save']}" />
  <h:messages />
  <hr />
               
  <h:panelGroup id="clientOnServerSide">
    <h:panelGrid columns="2">
                   
      <h:outputText value="#{msg['Client.name']}" />
      <h:outputText value="#{clientView.client.name}" />
                       
      <h:outputText value="#{msg['Client.vip']}" />
      <h:outputText value="#{clientView.client.vip}" />
                       
      <h:outputText value="#{msg['Client.country']}" />
      <h:outputText value="#{clientView.country.name}" />
                       
      <h:outputText value="#{msg['Client.city']}" />
      <h:outputText value="#{clientView.client.city.name}" />
 
    </h:panelGrid>
  </h:panelGroup>
               
</h:form>
</h:body>
<!--/f:view-->
</ui:composition>
    
  